<?php session_start();header('Content-Type: text/html; charset=utf-8'); 
$host  = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_NAME'] == 'localhost'){$uri="/kalender";}else{$uri="";}if (!isset($_SESSION['id_user']) || $_SESSION['id_user']=='') {	echo "<script language=Javascript> location.href='http://$host$uri/index.php'; </script>";	}else{	if (!is_object($bd)){			//me conecto a la base de datos		require("../globals/Db.class.php");		require("../globals/Conf.class.php");		$bd=Db::getInstance();		}	if (!is_object($util)){			include("../globals/Util.class.php");				$util=Util::getInstance();	}		$cliente = $_POST["cliente"];	$params = explode(" ",$cliente);		$query = "select * from usuarios where ";	$or = "";	for ($i=0; $i<sizeof($params); $i++){		$valor = $params[$i];		$query .= " $or upper(razon_social) like upper('%$valor%') ";			$query .= " or upper(cuit) like upper('%$valor%') ";		$or = "or";	}	//echo($query);	$resultado = $bd->eje($query);			$num_rows = $bd->numRows($resultado);		if ($num_rows==0){		echo("No se encontraron clientes...");	}else{
		for ($i=0; $i<$num_rows; $i++){
			$row = $bd->fila($resultado);
			$razon_social = $row["razon_social"];
			$direccion = $row["direccion"];
			$cuit = $row["cuit"];
			$id = $row["id"];
			$contacto = $row["contacto"];
			$telefono = $row["telefono"];
			echo("<div class='hoverSurf' style='cursor:pointer' onclick='selectDistrib($id,\"$razon_social\")'>$razon_social - $cuit - $direccion </div>");
		}	}
}
	
?>	